@echo off
title Download Maven
echo.
echo ====================================
echo   Downloading Maven...
echo ====================================
echo.

REM Create .mvn/wrapper directory if not exists
if not exist ".mvn\wrapper" (
    echo Creating .mvn\wrapper directory...
    mkdir .mvn\wrapper
)

REM Download maven-wrapper.jar using Java
echo Downloading maven-wrapper.jar...
"%JAVA_HOME%\bin\java" -cp . DownloadFile "https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" ".mvn\wrapper\maven-wrapper.jar"

if exist ".mvn\wrapper\maven-wrapper.jar" (
    echo ✅ Maven wrapper downloaded successfully!
) else (
    echo ❌ Failed to download Maven wrapper
    pause
    exit /b 1
)

echo.
echo Maven wrapper is ready!
pause